package com.qili.controller.base;

import com.qili.entity.base.BaseCompany;
import com.qili.service.base.BaseCompanyService;
import com.qili.util.ReType;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;

/**
 * @Author Zhangshuo
 * @date 2020/11/23 11:18
 **/
@Controller
@Slf4j
@RequestMapping("/sys/base")
public class BaseCompanyController {

    @Autowired
    private BaseCompanyService baseCompanyService;

    /**
     * @param baseCompany
     * @Author:Zhangshuo
     * @Description:
     * @Date:11:19 2020/11/23
     */
    @ResponseBody
    @RequestMapping(value = "/comdict", method = RequestMethod.GET)
    public ReType getCompanyDict(BaseCompany baseCompany,String keywords) {
        ReType re = new ReType();
        try {
            baseCompany.setBcName(keywords);
            List<BaseCompany> AlstCompany = baseCompanyService.getCompanyDict(baseCompany);
            re.setCode(0);
            re.setData(AlstCompany);
        } catch (Exception e) {
            e.printStackTrace();
            re.setCode(1);
            re.setMsg("获取公司信息异常！！" + e.getMessage());
        }
        return re;
    }
}
